<?php

class Laporan_permintaan extends CI_Controller {
	
	function Laporan_permintaan()
	{
		parent::__construct();
		$this->load->model('Home_model', '', TRUE);
		$this->load->model('auth_model', '', TRUE);
		$this->load->model('peternakan_model', '', TRUE);
		$this->load->model('laporan/lap_permintaan');
	}
	
	function index()
	{
		if ($this->session->userdata('login') == FALSE){
			redirect('auth');
		}else{
			$id_role = $this->session->userdata('id_role'); 
			$data = array(
				"main_view" => "laporan/lap_permintaan/lap_permintaan_view",
				"title"		=> "Permintaan Produk Sapi",
				"nama_user"	=> "Admin",
				
				
				"sum_rph"			=> $this->lap_permintaan->get_sum_produksi_rph(),
				"rph_date"			=> $this->lap_permintaan->get_rph_date(),
				"sum_permintaan"	=> $this->lap_permintaan->get_sum_permintaan(),
				"permintaan_date"	=> $this->lap_permintaan->get_permintaan_date(),
				
				
				"hak_akses0"=> $this->Home_model->get_hak_akses($id_role,0),
				"hak_akses1"=> $this->Home_model->get_hak_akses($id_role,1),
				"hak_akses2"=> $this->Home_model->get_hak_akses($id_role,2)
			);
			//var_dump($data['sum_rph']->result_array());
			$this->load->view('template', $data);
		}
		
	}
	
}